package com.prs.crm.domain.doc;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.domain.Attachment;
import com.prs.crm.domain.FlowCodeEntity;
import com.prs.crm.domain.sys.Code;

@Entity
@Table(name="doc_userdoc")
public class UserDoc extends FlowCodeEntity{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	@ManyToOne
	private DocType type;
	private String name;
	private String userDoccode;
	@Lob
	private String remark;
	@ManyToOne(fetch=FetchType.LAZY)
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	private Attachment attach;
	private String state;
	@OneToMany(fetch=FetchType.LAZY,mappedBy="userDoc")
	private Set<ShareUserDoc> shares;

	
	public String getUserDoccode() {
		return userDoccode;
	}
	public void setUserDoccode(String userDoccode) {
		this.userDoccode = userDoccode;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public DocType getType() {
		return type;
	}
	public void setType(DocType type) {
		this.type = type;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}

	public void setState(String state) {
		this.state = state;
	}
	public String getState() {
		return state;
	}
	public void setShares(Set<ShareUserDoc> shares) {
		this.shares = shares;
	}
	public Set<ShareUserDoc> getShares() {
		return shares;
	}
	public void setAttach(Attachment attach) {
		this.attach = attach;
	}
	public Attachment getAttach() {
		return attach;
	}
	
}
